from datetime import datetime
from django.db import models
from django.contrib.auth.models import User

class IssueManager(models.Manager):
    def active(self):
        return self.filter(active=True)


class Issue(models.Model):
    name = models.CharField(max_length=128)
    slug = models.SlugField(unique=True)
    description = models.TextField(help_text='Use <a href="http://daringfireball.net/projects/markdown/syntax">Markdown syntax</a> or HTML for formatting.')
    active = models.BooleanField(default=True)
    create_date = models.DateTimeField(auto_now_add=True)

    objects = IssueManager()

    def __unicode__(self):
        return self.name

    class Meta:
        ordering = ('name', 'id')
